package designmode.Decorate.myio;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Administrator on 2017/10/31 0031.
 */
public class LowerCaseInputStream extends FilterInputStream
{
    protected LowerCaseInputStream(InputStream in)
    {
        super(in);
    }

    public int read() throws IOException
    {
        int c = super.read();
        return (c == -1) ? c : Character.toLowerCase((char)c);
    }

    @Override
    public int read(byte[] b, int off, int len) throws IOException
    {
        int result = super.read(b, off, len);
        for (int i = 0; i < off + result; i++)
        {
            b[i] = (byte)Character.toLowerCase((char)b[i]);
        }
        return result;
    }
}
